package com.bbdjt.weixin.service.impl;

import java.util.List;


import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;
import tk.mybatis.mapper.util.StringUtil;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.bbdjt.weixin.model.OperatorQueryModel;
import com.bbdjt.weixin.base.service.impl.BaseServiceImpl;
import com.bbdjt.weixin.dao.OperatorDao;
import com.bbdjt.weixin.model.Operator;
import com.bbdjt.weixin.service.OperatorService;

@Service("operatorService")
public class OperatorServiceImpl extends BaseServiceImpl<Operator> implements OperatorService {
	
	@Override
    public List<Operator> selectByOperator(Operator operator, int page, int rows) {
        Example example = new Example(Operator.class);
        Example.Criteria criteria = example.createCriteria();
        criteria.andEqualTo(operator);
        PageHelper.startPage(page, rows);
        return selectByExample(example);
    }
    
    @Override
    public List<Operator> selectByOperator(Operator operator) {
        Example example = new Example(Operator.class);
        Example.Criteria criteria = example.createCriteria();
        criteria.andEqualTo(operator);
        return selectByExample(example);
    }

    @Override
    public PageInfo<OperatorQueryModel> selectByOperatorQueryModel(OperatorQueryModel operator) {
    	return ((OperatorDao) getMapper()).selectByOperatorModel(operator);
    }

	@Override
	public List<Operator> selectByOperator(OperatorQueryModel operator) {
		  Example example = new Example(Operator.class);
	        Example.Criteria criteria = example.createCriteria();
	        criteria.andEqualTo(operator);
	        PageHelper.startPage(operator.getPageNum(), operator.getPageSize(),operator.getOrderBy());
	        return selectByExample(example);
	}

	
}